//
//  cellWithAnimation.m
//  Review-Objective-C
//
//  Created by mac on 2017/7/19.
//  Copyright © 2017年 com.qiankun. All rights reserved.
//

#import "cellWithAnimation.h"

@implementation cellWithAnimation

+ (instancetype)cellFromXib:(UITableView *)tableView cellAnchorPoint:(CGPoint)cellAnchorPoint angle:(CGFloat)angle
{
    cellWithAnimation *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    
    if (!cell) {
        
         cell = (cellWithAnimation *)[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
//        [[[NSBundle mainBundle] loadNibNamed:NSStringFromClass(self) owner:nil options:nil] lastObject];
    }
    //动画设置
    CATransform3D transform = CATransform3DMakeRotation(angle, 0.0, 0.5, 0.3);
    
    transform.m34 = -1.0/500.0; // 设置透视效果
    
    cell.layer.transform = transform;
    //锚点
    cell.layer.anchorPoint = cellAnchorPoint;
    
    [UIView animateWithDuration:0.6 animations:^{
        cell.layer.transform = CATransform3DIdentity;
    }];
    
    return cell;
}



- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
